package com.demo;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionLoader;

import java.util.Set;

/**
 * @author: lipan
 * @date: 2021/12/13 22:44
 */

public class Main {

    public static void main(String[] args) {

//        ExtensionLoader<OrderService> extensionLoader = ExtensionLoader.getExtensionLoader(OrderService.class);
//        Set<String> supportedExtensions = extensionLoader.getSupportedExtensions();
//        for (String supportedExtension : supportedExtensions) {
//            OrderService service = extensionLoader.getExtension(supportedExtension);
//            service.getOrder();
//        }


//        URL url = URL.valueOf("test://localhost/hello?order.service=");  //不指定就是spi中指定的默认的 不然就报错
                URL url = URL.valueOf("test://localhost/hello?order.service=wms");

        final OrderService adaptiveExtension = ExtensionLoader.getExtensionLoader(OrderService.class).getAdaptiveExtension();
        adaptiveExtension.getOrder(url);
    }
}
